// 本地存储的模块
const TokenKey = 'hm-85-mobile-token'
const HistoryKey = 'hm-85-mobile-history'
// 存token
export const setToken = (tokenInfo) => {
  localStorage.setItem(TokenKey, JSON.stringify(tokenInfo))
}
// 取token
export const getToken = () => {
  // 取到的token肯定是有用的,函数一定要有返回值
  return JSON.parse(localStorage.getItem(TokenKey)) || {}
}
// 移除token
export const removeToken = () => {
  localStorage.removeItem(TokenKey)
}

// 存History
export const setHistory = (HistoryInfo) => {
  localStorage.setItem(HistoryKey, JSON.stringify(HistoryInfo))
}
// 取History
export const getHistory = () => {
  // 取到的History肯定是有用的,函数一定要有返回值
  return JSON.parse(localStorage.getItem(HistoryKey)) || []
}
// 移除History
export const removeHistory = () => {
  localStorage.removeItem(HistoryKey)
}
